package minio.controller;



import io.minio.errors.*;
import minio.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;


@RestController
@RequestMapping("/minio")
public class MinioController {

    @Autowired
    private FileService fileService;


    @PostMapping("upload")
    public String upload(MultipartFile file, String md5) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, XmlParserException, InvalidResponseException, InternalException {
       return fileService.upload(file,md5);
    }



}
